package cn.itrip.trade.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016091400508556";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCBFpZ0PYhNC3cisPAIb8XVNvnXxYCJ79uYIa+iEvt+5t5X7qRrEPTw/369gZ90zYuV4VpfsOjuQT9YJewrNDH0oRk9aA5tThdLHfs0UEoiE7ngC5AD+btJhqCL7V07hDN0vijOjOnxx4QMHXucq6Ng2n3KjmDS1DQrC9DlKDLdV8mKpASorRtCtzWpk2W1epJ4xlTmaTMbXzhP8qDmw1nW5YEq7qSdFiOVdw3mZdRxYVNDrStzJEyezWOB6VU06wxQHceVXQYvw/JHGqPQnQ2nlY78dra5L//0yNdRSUoFeN78wLKaMpHWEDyXOL/rGz/VVudYCkTODNa2gzF4tVn1AgMBAAECggEAZeyRyyIylrKw1IFkZSTrzZfk2YumHEN43bvrU0strFtZv5A73hW7cPYq+jJ41t7ckfEnTFsA7+4wt8bpnItPzlnM9gFNMtzv422+xOWIQzPUFaTLh3gNetaDuTgn3zBY+JqU2dHFfhQMnQxCZ8fV7klV/TNCG/VVY4+m1ulQkBb7KQ7Jmaw/x8x8eEY+s7IcAqqxUn4Xgk0E5UgRAKOAZ8nhJ35Qq/tHN+D8JGsTTVqbdGd0KsLA1F7lVvWEhgW73EVMDb42g0hVuXcFJ1spw5kNLiczFe/A7oNMxLkI47dgd7DFi4JY7VpAOM/4FUIGDJ7eFt/dLkDthiQOg48FwQKBgQC/NQsLmXYmOKkI8GuarU1v3TP+xspozC5Dvs17AmQsMb4iGUy5UOdb0zw/YYXuqx9RDl3bVNUSY2SuiCmkwvuiZUXJtb1bW+LMOJOACE3wAN8tvcbk+WMLy457fbDR1cOjJVDuJQGFZhdAzUUE0/SLHTbr7Q5UmoGAqaSsF9Jg7QKBgQCs1M+qlYDcnpSFS4BQcIeIW9Z4Sw9ZlFxn72e08WuNF0Ftw+n4Tq+wil/U7wG34bcqS7JQeTmwb5gIn9BGY2sxvxCWJ4aNx6peKNLhBcMac5fuQU6UgbLbkmpC7pGk6mVQqgZQ1t7X0ewSx0UMldHiSkCFhDmmYMV8s+ZsaBykKQKBgArdbL8//SK23YQQhUzIxDmzDB1SFnZWA9r9oJd4z1BjkzZE0cNGAZ+KJUZEuGOTfbgRZOvtqh3dX/865YLjQYE81/ZaSWRDmGOaY2dHEYatxgDHY+Hm+eXVr0b9IWsLBo7is/KUT73Qy0l3YJChqqetBU3qroHINcul2CGfSOkRAoGAFoTH5gcCujwjR9bViiWPUzH8GMJW5qoQ/C3SSl4mUETWbpHXO1YtSAhPgjP9+lJ7hhRE0H1rCdUQbxc7kOBFSD8HzzipLHH2fbw99bnFeP3UruNtdKYNgtRp6fyhl2Y++yqcFg5ZDK+6XZv/ICupJB3emEbpKAd109Cw1jEegjkCgYAm2juT/XRKGURcW+NaPXzbArR8L6y+XQzZemde4v5e8DZbMEsvS7DCASy64k6ICePrwk5ElF+oh1P66R0qWw5+7DnQUZcdyHClDm8IyM4Nc47KkScukQpCnLAbgpdTMYyDgnxf08Z/pEMbgshMo4QE6lfbMXml1iVzHbkEw0YDlw==";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArsGrXfEEBvR/2QlZM3ZVJe52Y4Db3A30DjMEbV16FKqGDwgJtFCXDuKUdYLQHhA27I/CgGA9pI7zvSQRImUrQPh30TF4GW8MLJLfQoTTEKGaYss38KzqjgF0LCyh7Xu29mvk+VR+5E/GtqRLtHS7TIFBOmIgsssKyKcof0AXNMtaHbXzyXVY0Zdxa+K2xwbuwEKD4Zqb3FIDgl2/mZIFslOi8MsfYqObbNdDJavc2fqP3RYd0eLEio3rLv/3nZVO6EhTeQBjG6nrApGo7oxGMkeZqaZyiwKMdDYYo40Oxv8XUXH6TGD3wDUqsZLXaBTwqWb+zeUO6wLTB5YcfCepUwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://127.0.0.1:8080/trade/api/notify";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://127.0.0.1:8080/trade/api/return";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

